package top.fangwenmagician.killfire;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import top.fangwenmagician.killfire.entity.IceHeartEntity;
import top.fangwenmagician.killfire.entity.IceHeartEntityLv1;
import top.fangwenmagician.killfire.entity.IceHeartEntityLv2;
import top.fangwenmagician.killfire.entity.IceHeartEntityLv3;
import top.fangwenmagician.killfire.item.IceHeartItemLv1;
import top.fangwenmagician.killfire.item.IceHeartItemLv2;
import top.fangwenmagician.killfire.item.IceHeartItemLv3;

public class KillFireMod implements ModInitializer {
    public static final String ModID = "kill_fire";
    public static final ItemGroup propGroup = FabricItemGroupBuilder.build(
            new Identifier(ModID, "prop_group"),
            () -> new ItemStack(KillFireMod.propItem));
    public static final Item propItem = Registry.register(Registry.ITEM, new Identifier(ModID, "prop"),
            new Item(new FabricItemSettings().group(propGroup)));
    public static final Item iceHeartItemLv1 = Registry.register(Registry.ITEM, new Identifier(ModID, "ice_heart_lv1"),
            new IceHeartItemLv1(new Item.Settings().group(propGroup).maxCount(64).fireproof()));
    public static final Item iceHeartItemLv2 = Registry.register(Registry.ITEM, new Identifier(ModID, "ice_heart_lv2"),
            new IceHeartItemLv2(new Item.Settings().group(propGroup).maxCount(16).fireproof()));
    public static final Item iceHeartItemLv3 = Registry.register(Registry.ITEM, new Identifier(ModID, "ice_heart_lv3"),
            new IceHeartItemLv3(new Item.Settings().group(propGroup).maxCount(1).fireproof()));

    public static final EntityType<IceHeartEntity> iceHeartEntityTypeLv1 = Registry.register(
            Registry.ENTITY_TYPE,
            new Identifier(ModID, "ice_heart_entity_lv1"),
            FabricEntityTypeBuilder.<IceHeartEntity>create(SpawnGroup.MISC, IceHeartEntityLv1::new)
                    .dimensions(EntityDimensions.fixed(0.25F, 0.25F)) // dimensions in Minecraft units of the projectile
                    .trackRangeBlocks(64).trackedUpdateRate(10) // necessary for all thrown projectiles (as it prevents it from breaking, lol)
                    .build() // VERY IMPORTANT DONT DELETE FOR THE LOVE OF GOD PSLSSSSSS
    );
    public static final EntityType<IceHeartEntity> iceHeartEntityTypeLv2 = Registry.register(
            Registry.ENTITY_TYPE,
            new Identifier(ModID, "ice_heart_entity_lv2"),
            FabricEntityTypeBuilder.<IceHeartEntity>create(SpawnGroup.MISC, IceHeartEntityLv2::new)
                    .dimensions(EntityDimensions.fixed(0.25F, 0.25F)) // dimensions in Minecraft units of the projectile
                    .trackRangeBlocks(64).trackedUpdateRate(10) // necessary for all thrown projectiles (as it prevents it from breaking, lol)
                    .build() // VERY IMPORTANT DONT DELETE FOR THE LOVE OF GOD PSLSSSSSS
    );
    public static final EntityType<IceHeartEntity> iceHeartEntityTypeLv3 = Registry.register(
            Registry.ENTITY_TYPE,
            new Identifier(ModID, "ice_heart_entity_lv3"),
            FabricEntityTypeBuilder.<IceHeartEntity>create(SpawnGroup.MISC, IceHeartEntityLv3::new)
                    .dimensions(EntityDimensions.fixed(0.25F, 0.25F)) // dimensions in Minecraft units of the projectile
                    .trackRangeBlocks(64).trackedUpdateRate(10) // necessary for all thrown projectiles (as it prevents it from breaking, lol)
                    .build() // VERY IMPORTANT DONT DELETE FOR THE LOVE OF GOD PSLSSSSSS
    );


    public KillFireMod() {

    }

    @Override
    public void onInitialize() {
//        EntityRendererRegistry.register(KillFireMod.iceHeartEntityTypeLv1, FlyingItemEntityRenderer::new);
//        EntityRendererRegistry.register(KillFireMod.iceHeartEntityTypeLv2, FlyingItemEntityRenderer::new);
//        EntityRendererRegistry.register(KillFireMod.iceHeartEntityTypeLv3, FlyingItemEntityRenderer::new);
    }
}
